﻿using OpenTK;
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LDLib
{
    public class GUI
    {
        internal static Mesh mesh;

        public static List<GUIElement> guiElements = new List<GUIElement>();

        internal GUI()
        {
            mesh = MeshTools.CreatePlaneXY(Vector2.One);
        }

        internal void Update(double dt)
        {
            foreach(GUIElement guiElement in guiElements)
            {
                guiElement.Update(dt);
            }
        }

        internal void Render()
        {
            GL.Clear(ClearBufferMask.DepthBufferBit);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            R.Shaders["GUI"].Enable();
            foreach(GUIElement guiElement in guiElements)
            {
                guiElement.Render();
            }
        }
    }
}
